package com.feinno.urcs.group.api;

import com.feinno.urcs.group.entity.GroupIndex;
import com.feinno.urcs.types.MobileNo;
import org.helium.framework.annotations.ServiceInterface;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * IICUPDB -> [NEW]
 * <p>
 * GRP_UserGroupList
 * OwnerUri
 * GroupUri
 * IsCreator
 * <p>
 * * Created by honghao on 5/4/15.
 */
@ServiceInterface(id = "group:UserGroupListDao")
public interface UserGroupListDao {
	/**
	 * 1、创建人创建群的数量是否达到上限
	 * select count(*) from GRP_UserGroupList where OwnerUri = @ownerUri
	 *
	 * @param mobileNo 创建人的手机号
	 * @return
	 */
	boolean canCreateGroup(MobileNo mobileNo) throws Exception;

	/**
	 * 获取用户所有群的数量
	 *
	 * @param mobileNo
	 * @return
	 * @throws SQLException
	 */
	int getGroupCount(MobileNo mobileNo) throws Exception;

	/**
	 * 获取用户创建群的数量
	 *
	 * @param mobileNo
	 * @return
	 * @throws SQLException
	 */
	int getCreateGroupCount(MobileNo mobileNo) throws Exception;

	/**
	 * 获取用户所有的群
	 *
	 * @param mobileNo
	 * @return
	 * @throws SQLException
	 */
	List<GroupIndex> getUserGroupList(MobileNo mobileNo) throws Exception;

	/**
	 * * -- 3. insert into GRP_UserGroupList(MemberUri, GroupIndex)
	 */
	void insertUserGroupList(MobileNo mobileNo, GroupIndex index, int identity) throws Exception;

	void updateUserGroupIdentity(MobileNo mobileNo, GroupIndex index, int identity) throws Exception;
	void updateUserGroupIdentityWithUserId(int userid, GroupIndex index, int identity) throws Exception;


	void deleteUserGroupList(MobileNo mobileNo, GroupIndex index) throws Exception;

	void dismissGroup(GroupIndex index) throws SQLException;
}
